from pandas import DataFrame
from sqlalchemy import create_engine, text
import pandas as pd


def run(source: DataFrame, param_dict: dict):
    type = param_dict["type"]
    host = param_dict["host"]
    db = param_dict["db"]
    user = param_dict["user"]
    password = param_dict["password"]
    port = param_dict["port"]
    table = param_dict["table"]
    engine = create_engine('mysql+pymysql://%s:%s@%s:%s/%s?charset=utf8'
                       % (user, password, host, port, db))
    df = source.to_sql(name=table, con=engine,if_exists="fail")
    return df
